﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SuperFox.SuperServiceReference;
using System.Windows.Media.Imaging;

namespace SuperFox
{
    public partial class ClientHeader : UserControl
    {

        private DbStyles style = (App.Current.RootVisual as MainPage).CurrentUser.Programs.Style;

        public ClientHeader()
        {
            InitializeComponent();

            Color backgroundColor = Config.StringToColour(style.BackgroundColour);

            //LinearGradientBrush brush = new LinearGradientBrush()
            //{
            //    StartPoint = new Point(0.5, 0),
            //    EndPoint = new Point(0.5, 1)
            //};

            //brush.GradientStops.Add(new GradientStop()
            //{
            //    Color = backgroundColor,
            //    Offset = 0
            //});

            //brush.GradientStops.Add(new GradientStop()
            //{
            //    Color = backgroundColor,
            //    Offset = 0.7
            //});

            //backgroundColor.A = 200;

            //brush.GradientStops.Add(new GradientStop()
            //{
            //    Color = backgroundColor,
            //    Offset = 0.8
            //});

            //backgroundColor.A = 180;

            //brush.GradientStops.Add(new GradientStop()
            //{
            //    Color = backgroundColor,
            //    Offset = 0.83
            //});

            //backgroundColor.A = 0;

            //brush.GradientStops.Add(new GradientStop()
            //{
            //    Color = backgroundColor,
            //    Offset = 1
            //});


            LayoutRoot.Background = new SolidColorBrush(Config.StringToColour((App.Current.RootVisual as MainPage).CurrentUser.Programs.Style.BackgroundColour));

            ImageCanvas.Background = new ImageBrush()
            {
                ImageSource = new BitmapImage(new Uri(Config.PRODUCT_IMAGE_DIR + "/" + (App.Current.RootVisual as MainPage).CurrentUser.Programs.Style.Logo, UriKind.RelativeOrAbsolute)),
                Stretch = Stretch.None,
                AlignmentX = AlignmentX.Left
            };

            

            //Image img = new Image()
            //{
            //    Source = new BitmapImage(new Uri(Config.PRODUCT_IMAGE_DIR + "/" + (App.Current.RootVisual as MainPage).CurrentUser.Programs.merc_logo, UriKind.RelativeOrAbsolute)),
            //    Stretch = Stretch.None
            //};

            //img.SetValue(Image.HorizontalAlignmentProperty, HorizontalAlignment.Left);
            //img.SetValue(Image.MarginProperty, new Thickness(20, 20, 20, 20));

            //LayoutRoot.Children.Add(img);
        }
    }
}
